package com.jkoss.wine.shop.controller;

import java.text.ParseException;
import java.util.ArrayList;
import java.util.HashMap;
import java.util.List;
import java.util.Map;

import javax.servlet.http.HttpServletRequest;
import javax.servlet.http.HttpServletResponse;
import javax.validation.Valid;

import org.apache.shiro.authz.annotation.RequiresPermissions;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Controller;
import org.springframework.ui.ModelMap;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.ResponseBody;

import com.alibaba.fastjson.JSON;
import com.baomidou.mybatisplus.mapper.Condition;
import com.baomidou.mybatisplus.mapper.Wrapper;
import com.baomidou.mybatisplus.plugins.Page;
import com.jkoss.base.controller.BaseController;
import com.jkoss.common.util.CommonUtil;
import com.jkoss.common.vo.DwzPageBean;
import com.jkoss.wine.config.mvc.MoneyExcelHandler;
import com.jkoss.wine.shop.entity.Shop;
import com.jkoss.wine.shop.service.IProductInventoryService;
import com.jkoss.wine.shop.service.IShopService;
import com.jkoss.wine.shop.vo.ShopOrderListVo;
import com.jkoss.wine.shop.vo.ShopVo;
import com.jkoss.wine.shop.vo.shopListVo;
import com.jkoss.wine.system.entity.Areas;
import com.jkoss.wine.system.entity.MerchantEmployees;
import com.jkoss.wine.system.entity.Role;
import com.jkoss.wine.system.service.IAreasService;
import com.jkoss.wine.system.service.IMerchantEmployeesService;

import cn.afterturn.easypoi.entity.vo.NormalExcelConstants;
import cn.afterturn.easypoi.excel.entity.ExportParams;
import cn.afterturn.easypoi.excel.entity.enmus.ExcelType;
import cn.afterturn.easypoi.handler.inter.IExcelDataHandler;

/**
 * 店铺设置 前端控制器
 * 
 * @Author zhouhuajin
 * @Version 1.0, 2018-09-28
 * @See
 * @Since com.jkoss.wine.shop.controller
 * @Description: TODO
 */
@Controller
@RequestMapping("/shop/shop")
public class ShopController extends BaseController {

	@Autowired
	private IShopService iShopService;
	@Autowired
	private IAreasService iAreasService;
	@Autowired
	private IProductInventoryService iProductInventoryService;
	@Autowired
	private IMerchantEmployeesService iMerchantEmployeesService;

	/**
	 * 列表
	 * 
	 * @param dwzPageBean
	 * @param map
	 * @param request
	 * @param response
	 * @return
	 */
	@RequestMapping("/list")
	@RequiresPermissions("/shop/shop/list")
	public String list(String shopName, String shopNum, DwzPageBean dwzPageBean, ModelMap map, HttpServletRequest request, HttpServletResponse response) {
		String string1 = request.getParameter("org1.shopName");
		String string2 = request.getParameter("org2.shopNum");
		List<Role> roles = getRoleList();
		// 根据用户id获取角色
		Wrapper wrapper = Condition.create().ne("s.del", 1).like("s.shop_name", string1).like("s.shop_num", string2);
		boolean isDirector = true;
		for (Role role : roles) {
			if ("运营主管".equals(role.getName())) {
				isDirector = false;
			}
		}
		if (isDirector) {
			wrapper.eq("maid", getUserId());
		}
		// 前端框架bean
		dwzPageBean.getCountResultMap().put("shopName", string1);
		dwzPageBean.getCountResultMap().put("shopNum", string2);
		// 字段排序
		if (!CommonUtil.isBlank(dwzPageBean.getOrderField()) && !CommonUtil.isBlank(dwzPageBean.getOrderDirection())) {
			dwzPageBean.getCountResultMap().put("orderField", dwzPageBean.getOrderField());
			dwzPageBean.getCountResultMap().put("orderDirection", dwzPageBean.getOrderDirection());
			wrapper.orderBy(dwzPageBean.getOrderField(), CommonUtil.isEquals(dwzPageBean.getOrderDirection(), "asc"));
		} else {
			wrapper.orderBy("s.add_time", false);
		}
		// 构建排序条件 是否删除：0-未删除、1-已删除、2-不能删除
		Page resultPage = iShopService.selectVoByPage(dwzPageBean.toPage(), wrapper);
		map.put("dwzPageBean", dwzPageBean.toDwzPageBean(resultPage));
		return "shop/shop/list";
	}

	/**
	 * 客户列表
	 * 
	 * @param shopName
	 * @param areaName
	 * @param sffwtm
	 * @param dwzPageBean
	 * @param map
	 * @param request
	 * @param response
	 * @return
	 * @throws Exception
	 */
	@RequestMapping("/shoplist")
	@RequiresPermissions("/shop/shop/shoplist")
	public String shoplist(String shopName, String fwtm, String areaCode, String startTime, String endTime, DwzPageBean dwzPageBean, ModelMap map, HttpServletRequest request, HttpServletResponse response) throws Exception {
		String string = request.getParameter("org2.shopName");
		// 省市级
		Wrapper wrapper1 = Condition.create().like("id", "0000");
		List<Areas> provinces = iAreasService.selectList(wrapper1);
		map.put("provinces", provinces);
		String repAreaCode = "";
		if (!CommonUtil.isBlank(areaCode)) {
			String[] areas = areaCode.split(",");
			for (int i = 0; i < areas.length; i++) {
				repAreaCode += areas[i];
				if (i != 2 && areas.length - 1 > i && !CommonUtil.isBlank(areas[i + 1])) {
					repAreaCode += ",";
				}
			}
			if (areas.length >= 1 && !CommonUtil.isBlank(areas[0])) {
				dwzPageBean.getCountResultMap().put("province", areas[0]);
				if (areas.length >= 2 && !CommonUtil.isBlank(areas[0])) {
					dwzPageBean.getCountResultMap().put("city", areas[1]);
				}
				// 市
				String city = areas[0].substring(0, 2);
				Wrapper cityWrapper = Condition.create().andNew("id like '" + city + "%00'").ne("id", city + "0000");
				List<Areas> citys = iAreasService.selectList(cityWrapper);
				map.put("citys", citys);
			}
			if (areas.length >= 2 && !CommonUtil.isBlank(areas[1])) {
				if (areas.length >= 3 && !CommonUtil.isBlank(areas[0])) {
					dwzPageBean.getCountResultMap().put("county", areas[2]);
				}
				// 区
				String county = areas[1].substring(0, 4);
				Wrapper countyWrapper = Condition.create().andNew("id like '" + county + "%'").ne("id", county + "00");
				List<Areas> countys = iAreasService.selectList(countyWrapper);
				map.put("countys", countys);
			}
		}
		Wrapper wrapper = Condition.create().ne("sdel", 1).eq("shop_state", 1).eq("state", 4).like("shop_name", string).like("area_code", repAreaCode);
		// 根据用户id获取角色
		boolean isDirector = true;
		List<Role> roles = getRoleList();
		for (Role role : roles) {
			if ("运营主管".equals(role.getName())) {
				isDirector = false;
			}
		}
		if (isDirector) {
			wrapper.eq("aa.maid", getUserId());
		}
		// 字段排序
		if (!CommonUtil.isBlank(dwzPageBean.getOrderField()) && !CommonUtil.isBlank(dwzPageBean.getOrderDirection())) {
			dwzPageBean.getCountResultMap().put("orderField", dwzPageBean.getOrderField());
			dwzPageBean.getCountResultMap().put("orderDirection", dwzPageBean.getOrderDirection());
			wrapper.orderBy(dwzPageBean.getOrderField(), CommonUtil.isEquals(dwzPageBean.getOrderDirection(), "asc"));
		} else {
			wrapper.orderBy("aa.fwtm", false);
		}
		// 前端框架bean
		dwzPageBean.getCountResultMap().put("shopName", string);
		dwzPageBean.getCountResultMap().put("areaCode", areaCode);
		dwzPageBean.getCountResultMap().put("startTime", startTime);
		dwzPageBean.getCountResultMap().put("endTime", endTime);
		if (!CommonUtil.isBlank(startTime)) {
			// 大于等于开始时间
			wrapper.ge("fwtm", startTime);
		}
		if (!CommonUtil.isBlank(endTime)) {
			// 小于等于结束时间
			wrapper.le("fwtm", CommonUtil.dateLastTime(endTime));
		}
		// 构建排序条件 是否删除：0-未删除、1-已删除、2-不能删除
		Page resultPage = iShopService.selectVoByshopListPage(dwzPageBean.toPage(), wrapper, fwtm);
		map.put("dwzPageBean", dwzPageBean.toDwzPageBean(resultPage));
		return "shop/shop/shoplist";
	}

	/**
	 * 客户详情列表
	 * 
	 * @param shopId
	 * @param dwzPageBean
	 * @param map
	 * @param request
	 * @param response
	 * @return
	 */
	@RequestMapping("/ShopOrderList")
	@RequiresPermissions("/shop/shop/ShopOrderList")
	public String ShopOrderList(String shopId, DwzPageBean dwzPageBean, ModelMap map, HttpServletRequest request, HttpServletResponse response) {
		Wrapper wrapper = Condition.create().ne("s.del", 1).ne("mo.del", 1).eq("s.shop_id", shopId);
		// 字段排序
		if (!CommonUtil.isBlank(dwzPageBean.getOrderField()) && !CommonUtil.isBlank(dwzPageBean.getOrderDirection())) {
			dwzPageBean.getCountResultMap().put("orderField", dwzPageBean.getOrderField());
			dwzPageBean.getCountResultMap().put("orderDirection", dwzPageBean.getOrderDirection());
			wrapper.orderBy(dwzPageBean.getOrderField(), CommonUtil.isEquals(dwzPageBean.getOrderDirection(), "asc"));
		} else {
			wrapper.orderBy("add_time", false);
		}
		Page resultPage = iShopService.selectVoByShopOrderListPage(dwzPageBean.toPage(), wrapper);
		map.put("dwzPageBean", dwzPageBean.toDwzPageBean(resultPage));
		map.put("record", iShopService.selectById(shopId));
		return "shop/shop/ShopOrderList";
	}

	/**
	 * 库存详情
	 * 
	 * @param shopId
	 * @param dwzPageBean
	 * @param map
	 * @param request
	 * @param response
	 * @return
	 */
	@RequestMapping("/ProductInventoryList")
	@RequiresPermissions("/shop/shop/ProductInventoryList")
	public String ProductInventoryList(String shopId, String normName, DwzPageBean dwzPageBean, ModelMap map, HttpServletRequest request, HttpServletResponse response) {
		// 前端框架bean
		dwzPageBean.getCountResultMap().put("normName", normName);
		Wrapper wrapper = Condition.create().eq("pit.shop_id", shopId).groupBy("pit.product_norm_id").like("pn.norm_name", normName).ne("pn.del", 1);
		// 字段排序
		if (!CommonUtil.isBlank(dwzPageBean.getOrderField()) && !CommonUtil.isBlank(dwzPageBean.getOrderDirection())) {
			dwzPageBean.getCountResultMap().put("orderField", dwzPageBean.getOrderField());
			dwzPageBean.getCountResultMap().put("orderDirection", dwzPageBean.getOrderDirection());
			wrapper.orderBy(dwzPageBean.getOrderField(), CommonUtil.isEquals(dwzPageBean.getOrderDirection(), "asc"));
		} else {
			wrapper.orderBy("pit.add_time", false);
		}

		Page resultPage = iProductInventoryService.selectVoByProductInventoryPage(dwzPageBean.toPage(), wrapper);
		map.put("shopId", shopId);
		map.put("dwzPageBean", dwzPageBean.toDwzPageBean(resultPage));
		return "shop/shop/ProductInventoryList";
	}

	/**
	 * 去新增
	 * 
	 * @param request
	 * @param response
	 * @return
	 */
	@RequestMapping("/toInsert")
	@RequiresPermissions("/shop/shop/toInsert")
	public String toInsert(ModelMap map, HttpServletRequest request, HttpServletResponse response) {
		Wrapper wrapper = Condition.create().like("id", "0000");
		List<Areas> provinces = iAreasService.selectList(wrapper);
		Wrapper wrapper2 = Condition.create().ne("del", 1);
		List<MerchantEmployees> employeeslist = iMerchantEmployeesService.selectList(wrapper2);
		map.put("provinces", provinces);
		map.put("employeeslist", employeeslist);
		return "shop/shop/edit";
	}

	@RequestMapping("/insert")
	@RequiresPermissions("/shop/shop/toInsert")
	@ResponseBody
	public Object insert(@Valid Shop shop, HttpServletRequest request, HttpServletResponse response) throws Exception {
		// 判断店铺名称是否存在
		// Wrapper wrapper = Condition.create().eq("shop_name", shop.getShopName());
		// Shop shop2 = iShopService.selectOne(wrapper);
		// if (!CommonUtil.isBlank(shop2)) {
		// return ajaxError("店铺名称已存在");
		// }
		// 判断店铺名称是否存在
		Wrapper wrapper = Condition.create().eq("shop_name", shop.getShopName());
		Shop shop2 = iShopService.selectOne(wrapper);
		if (!CommonUtil.isBlank(shop2) && shop2.getDel() == 0) {
			return ajaxError("店铺名称已存在");
		}
		// 判断联系电话是否存在
		Wrapper wrapper1 = Condition.create().eq("contact_number", shop.getContactNumber());
		Shop shop3 = iShopService.selectOne(wrapper1);
		if (!CommonUtil.isBlank(shop3)) {
			return ajaxError("电话号码已存在");
		}
		// 获取当前操作人
		shop.setOperator(getUserId());
		// 财务
		shop.setBelongs(getUserId());
		if (iShopService.insertShop(shop)) {
			return ajaxSuccess();
		} else {
			return ajaxError();
		}

	}

	/**
	 * 去修改
	 * 
	 * @param id
	 * @param map
	 * @param request
	 * @param response
	 * @return
	 */
	@RequestMapping("/toUpdate")
	@RequiresPermissions("/shop/shop/toUpdate")
	public String toUpdate(String id, ModelMap map, HttpServletRequest request, HttpServletResponse response) {
		Wrapper wrapper2 = Condition.create().ne("del", 1);
		List<MerchantEmployees> employeeslist = iMerchantEmployeesService.selectList(wrapper2);
		map.put("employeeslist", employeeslist);
		Shop shop = iShopService.selectById(id);
		String string = shop.getAreaCode();
		String[] strings = string.split(",");
		String province = strings[0];
		// 省
		Wrapper wrapper = Condition.create().like("id", "0000");
		List<Areas> provinces = iAreasService.selectList(wrapper);
		map.put("provinces", provinces);
		map.put("province", province);
		// 市
		String city = province.substring(0, 2);
		Wrapper cityWrapper = Condition.create().andNew("id like '" + city + "%00'").ne("id", city + "0000");
		List<Areas> citys = iAreasService.selectList(cityWrapper);
		map.put("citys", citys);
		map.put("city", strings[1]);
		// 区
		String county = strings[1].substring(0, 4);
		Wrapper countyWrapper = Condition.create().andNew("id like '" + county + "%'");
		List<Areas> countys = iAreasService.selectList(countyWrapper);
		map.put("countys", countys);
		map.put("county", strings[2]);
		map.put("record", iShopService.selectById(id));
		return "shop/shop/edit";
	}

	@RequestMapping("/update")
	@RequiresPermissions("/shop/shop/toUpdate")
	@ResponseBody
	public Object update(@Valid Shop shop, HttpServletRequest request, HttpServletResponse response) throws Exception {
		// // 判断店铺名称是否存在
		// Wrapper wrapper = Condition.create().eq("shop_name", shop.getShopName());
		// Shop shop2 = iShopService.selectOne(wrapper);
		// if (!CommonUtil.isBlank(shop2)) {
		// return ajaxError("店铺名称已存在");
		// }
		if (iShopService.updateShop(shop)) {
			return ajaxSuccess();
		} else {
			return ajaxError();
		}
	}

	/**
	 * 去删除
	 * 
	 * @param id
	 * @param request
	 * @param response
	 * @return
	 */
	@RequestMapping("/delete")
	@RequiresPermissions("/shop/shop/delete")
	@ResponseBody
	public Object delete(String[] id, HttpServletRequest request, HttpServletResponse response) {
		List list = new ArrayList();
		for (String string : id) {
			Shop shop = new Shop();
			shop.setShopId(string);
			// 是否删除：0-未删除、1-已删除、2-不能删除
			shop.setDel(1);
			list.add(shop);
		}
		if (iShopService.updateBatchById(list)) {
			return ajaxSuccess();
		} else {
			return ajaxError();
		}
	}

	/**
	 * 店铺启用/停用
	 * 
	 * @param id
	 * @param shop
	 * @param request
	 * @param response
	 * @return
	 */
	@RequestMapping("/stateShop")
	@RequiresPermissions("/shop/shop/stateShop")
	@ResponseBody
	public Object stopShop(Shop shop, HttpServletRequest request, HttpServletResponse response, ModelMap map) {
		if (iShopService.updateById(shop)) {
			return ajaxSuccess();
		} else {
			return ajaxError();
		}
	}

	/**
	 * 查询商铺名称
	 * 
	 * @param shopName
	 * @param request
	 * @param response
	 * @param map
	 * @return
	 */
	@RequestMapping("/getShopName")
	@ResponseBody
	public Object getShopName(String shopName, HttpServletRequest request, HttpServletResponse response, ModelMap map) {
		Wrapper wrapper = Condition.create().like("shop_name", shopName).ne("del", 1);
		List<Shop> list = iShopService.selectList(wrapper);
		return JSON.toJSONString(list);
	}

	@RequestMapping("/getShopNum")
	@ResponseBody
	public Object getShopNum(String shopNum, HttpServletRequest request, HttpServletResponse response, ModelMap map) {
		Wrapper wrapper = Condition.create().like("shop_num", shopNum).ne("del", 1);
		List<Shop> list = iShopService.selectList(wrapper);
		return JSON.toJSONString(list);
	}

	/**
	 * 查询客户名称
	 * 
	 * @param shopName
	 * @param request
	 * @param response
	 * @param map
	 * @return
	 */
	@RequestMapping("/getshoplistshopName")
	@ResponseBody
	public Object getshoplistshopName(String shopName, HttpServletRequest request, HttpServletResponse response, ModelMap map) {
		Wrapper wrapper = Condition.create().like("shop_name", shopName).eq("shop_state", 1).eq("state", 4).ne("del", 1);
		List<Shop> list = iShopService.selectList(wrapper);
		return JSON.toJSONString(list);
	}

	/**
	 * 导出Excel
	 * 
	 * @param map
	 * @param dwzPageBean
	 * @param request
	 * @param response
	 * @return
	 */
	@RequestMapping("/shopexport")
	@RequiresPermissions("/shop/shop/shopexport")
	public String shopexport(ModelMap map, DwzPageBean dwzPageBean, HttpServletRequest request, HttpServletResponse response) {
		/**
		 * @param 店铺删除不等于：
		 *            0-否、1-是("s.del",1)
		 * @param 店铺状态等于：
		 *            0-停用、1-启用("shop_state", 1)
		 * @return
		 */
		// 从数据库中查找数据
		Wrapper wrapper = Condition.create().ne("s.del", 1);
		// 根据用户id获取角色
		boolean isDirector = true;
		List<Role> roles = getRoleList();
		for (Role role : roles) {
			if ("运营主管".equals(role.getName())) {
				isDirector = false;
			}
		}
		if (isDirector) {
			wrapper.eq("maid", getUserId());
		}
		Page page = dwzPageBean.toPage();
		page.setSize(Page.NO_ROW_LIMIT);
		page.setCurrent(1);
		List list = iShopService.selectVoByPage(page, wrapper).getRecords();
		ExportParams params = new ExportParams(null, "店铺设置", ExcelType.XSSF);
		map.put(NormalExcelConstants.DATA_LIST, list); // 数据集合
		map.put(NormalExcelConstants.CLASS, ShopVo.class);// 导出实体
		map.put(NormalExcelConstants.PARAMS, params);// 参数
		map.put(NormalExcelConstants.FILE_NAME, "店铺设置");// 文件名称
		return NormalExcelConstants.EASYPOI_EXCEL_VIEW;// View名称
	}

	/**
	 * 导出客户列表Excel
	 * 
	 * @param map
	 * @param dwzPageBean
	 * @param request
	 * @param response
	 * @return
	 */
	@RequestMapping("/shopListexport")
	@RequiresPermissions("/shop/shop/shopListexport")
	public String shopListexport(ModelMap map, DwzPageBean dwzPageBean, HttpServletRequest request, HttpServletResponse response) {
		// 从数据库中查找数据
		Wrapper wrapper = Condition.create().ne("sdel", 1).eq("shop_state", 1).eq("state", 4);
		// 根据用户id获取角色
		boolean isDirector = true;
		List<Role> roles = getRoleList();
		for (Role role : roles) {
			if ("运营主管".equals(role.getName())) {
				isDirector = false;
			}
		}
		if (isDirector) {
			wrapper.eq("maid", getUserId());
		}
		Page page = dwzPageBean.toPage();
		page.setSize(Page.NO_ROW_LIMIT);
		page.setCurrent(1);
		List list = iShopService.selectVoByshopListPage(page, wrapper, null).getRecords();
		ExportParams params = new ExportParams(null, "客户列表", ExcelType.XSSF);
		map.put(NormalExcelConstants.DATA_LIST, list); // 数据集合
		map.put(NormalExcelConstants.CLASS, shopListVo.class);// 导出实体
		map.put(NormalExcelConstants.PARAMS, params);// 参数
		map.put(NormalExcelConstants.FILE_NAME, "客户列表");// 文件名称
		return NormalExcelConstants.EASYPOI_EXCEL_VIEW;// View名称
	}

	/**
	 * 导出客户详情Excel
	 * 
	 * @param map
	 * @param dwzPageBean
	 * @param request
	 * @param response
	 * @return
	 */
	@RequestMapping("/ShopOrderListexport")
	@RequiresPermissions("/shop/shop/ShopOrderListexport")
	public String ShopOrderListexport(ModelMap map, DwzPageBean dwzPageBean, HttpServletRequest request, HttpServletResponse response) {
		// 从数据库中查找数据
		Wrapper wrapper = Condition.create().ne("s.del", 1).ne("mo.del", 1).ne("em.del", 1).ne("me.del", 1).ne("sp.del", 1).eq("shop_state", 1);
		// 根据用户id获取角色
		boolean isDirector = true;
		List<Role> roles = getRoleList();
		for (Role role : roles) {
			if ("运营主管".equals(role.getName())) {
				isDirector = false;
			}
		}
		if (isDirector) {
			wrapper.eq("maid", getUserId());
		}
		Page page = dwzPageBean.toPage();
		page.setSize(Page.NO_ROW_LIMIT);
		page.setCurrent(1);
		List list = iShopService.selectVoByShopOrderListPage(page, wrapper).getRecords();
		ExportParams params = new ExportParams(null, "客户详情订单记录", ExcelType.XSSF);
		IExcelDataHandler dataHandler = new MoneyExcelHandler();
		dataHandler.setNeedHandlerFields(new String[] { "订单金额", "应收金额", "实收金额" });
		params.setDataHandler(dataHandler);
		map.put(NormalExcelConstants.DATA_LIST, list); // 数据集合
		map.put(NormalExcelConstants.CLASS, ShopOrderListVo.class);// 导出实体
		map.put(NormalExcelConstants.PARAMS, params);// 参数
		map.put(NormalExcelConstants.FILE_NAME, "客户详情订单记录");// 文件名称
		return NormalExcelConstants.EASYPOI_EXCEL_VIEW;// View名称
	}

	/**
	 * 门店操作修改门店状态,提供给门店调用的接口，不需要添加权限
	 * 
	 * @param map
	 * @param request
	 * @param response
	 * @return
	 */
	@RequestMapping("/changeState")
	@ResponseBody
	public Object changeState(String id, String state, HttpServletRequest request, HttpServletResponse response) {
		if (CommonUtil.isBlank(id)) {
			return resultMap("300", "id 不能为空");
		}
		if (CommonUtil.isBlank(state)) {
			return resultMap("300", "state 不能为空");
		}
		Shop shop = iShopService.selectById(id);
		if (CommonUtil.isBlank(shop)) {
			return resultMap("300", "请输入正确的店铺id");
		}
		// 门店状态：1-新客户、2-门店建设中、3-门店配货中、4-常规客户
		int shopState = CommonUtil.int2(state);
		if (!(shopState == 2 || shopState == 3 || shopState == 4)) {
			return resultMap("300", "请输入正确的店铺状态");
		}
		shop.setState(CommonUtil.int2(state));
		if (iShopService.updateById(shop)) {
			return resultMap("200", "修改成功");
		} else {
			return resultMap("300", "修改失败");
		}
	}

	/**
	 * 门店操作修改门店状态返回内容格式
	 * 
	 * @return
	 */
	private Object resultMap(String code, String msg) {
		Map map = new HashMap();
		map.put("code", code);
		map.put("message", msg);
		return map;
	}

}
